import Base from "./base";

class Position extends Base {
  isSpecific = false
  // siteSetType 1 自动 2 特定
  siteSetType: any = 2;
  value: Array<any> = [];
  //
  siteSet: Array<any> = [113, 122];

  scene_spec = {
    flow_optimization_enabled: 0,
    wechat_scene: {
      // CUSTOM => 自定义 'NONE' => 不限
      type: 'NONE',
      official_account_media_category: [],
      mini_program_and_mini_game: [],
      pay_scene: []
    },
    // wechat_position
    wechat_position: {
      type: 'NONE',
      value: []
    },
    mobile_union_category: {
      type: 'NONE',
      value: []
    },
    qbsearch_scene: {
      type: 'NONE',
      value: []
    },
    wechat_channels_scene: {
      type: 'NONE',
      value: []
    },
    display_scene: {
      type: 'NONE',
      value: []
    },
    tencent_news: {
      type: 'NONE',
      value: []
    },
    exclude_union_position_package: {
      type: 'NONE',
      value: []
    },
    union_position_package: {
      type: 'NONE',
      value: []
    },
    exclude_mobile_union: {
      type: 'NONE',
      value: []
    },
    mobile_union: {
      type: 'NONE',
      value: []
    }

  }

  name: string = '微信视频号';

  get pureName() {
    return this.name.replace(/搜索场景｜、搜索场景/, '');
  }
  get noCreativeScene() {
    return this.siteSet.length == 1 && this.siteSet[0] == 122;
  }
  // 是否为视频号
  get isWechatChannels() {
    const siteSetString = this.siteSet.join(',');
     const isOnlyChannel = this.siteSetType == 2 && (siteSetString == '122,113' || siteSetString == '113,122' || siteSetString == '113')
    return isOnlyChannel;
  }

  get isAutoSiteSet() {
    return this.siteSetType == 1;
  }
  constructor(options: any) {
    super();
    this.init(options);
    return this;
  }
}

export default Position
